import request from '@/config/axios'
import { encryptAES } from '@/components/LowDesign/src/utils/aes'

//获取多模块组合列表
export const getModuleList = (data) => {
  const url = `/jeelowcode/tab/page?pageNo=${data.pageNo}&pageSize=${data.pageSize}`
  delete data.pageNo
  delete data.pageSize
  return request.post({ url, data })
}

//新增多模块组合配置
export const saveModuleData = (data) => {
  return request.post({ url: '/jeelowcode/tab/save', data })
}

//修改多模块组合配置
export const updateModuleData = (data) => {
  return request.put({ url: '/jeelowcode/tab/update', data })
}

//删除多模块组合配置
export const deleteModuleData = (ids) => {
  return request.delete({ url: '/jeelowcode/tab/delete', data: ids })
}

/**
 * 获取多模块组合详情数据
 * @param id 
 */
export const getModuleDetail = (id) => {
  return request.post({ url: `/jeelowcode/tab/detail?id=${id}` })
}


//获取多模块组合分组数据
export const getGroupData = (params) => {
  return request.get({ url: `/jeelowcode/group/tab/list`, params })
}
//新增多模块组合分组
export const saveGroupData = (data) => {
  return request.post({ url: `/jeelowcode/group/tab/save`, data })
}
//修改多模块组合分组
export const updateGroupData = (data) => {
  return request.put({ url: `/jeelowcode/group/tab/update`, data })
}
//删除多模块组合分组
export const deleteGroupData = (ids) => {
  return request.delete({ url: '/jeelowcode/group/tab/delete', data: ids })
}

//新增Js增强
export const saveJsData = (data) => {
  data = encryptAES(JSON.stringify(data))
  return request.post({ url: '/jeelowcode/tab/js/save', data })
}

//修改Js增强
export const updateJsData = (data) => {
  data = encryptAES(JSON.stringify(data))
  return request.put({ url: '/jeelowcode/tab/js/update', data })
}

//获取Js增强详情数据
export const getJsDetail = (params) => {
  return request.get({ url: `/jeelowcode/tab/js/detail`, params })
}

//解除Js增强锁定
export const unlockJs = (moduleId, type) => {
  return request.post({ url: `/jeelowcode/tab/js/unlock/${moduleId}?type=${type}` })
}

//获取显示配置
export const getModelViewData = (moduleId) => {
  return request.get({ url: `/jeelowcode/tab/get/web-config?tabId=${moduleId}` })
}





